<template>
	<view class="page">
		<!-- 报名卡片 -->

		<scroll-view :style="{height:height+'px'}" lower-threshold="400" @scrolltolower='nextPage()' scroll-y
			refresher-default-style='white' :refresher-threshold="80" :refresher-triggered="refresherTriggered"
			@refresherrefresh="refresherrefresh" @refresherrestore="refresherrestore" @refresherabort="refresherabort">
			<view class="null box-c d-jc-c d-ai-c" v-if="isShow">
				<image class="mt-5" src="../../static/images/activity/shenqing@2x.png" mode=""></image>
				<text class="mt-3">您暂时还没报名任何团队~</text>
			</view>
			<view class="list-1 box-c d-ai-c" v-if="!isShow">
				<view class="record mt-2" :key=index v-for="(item,index) in applyRecordList">
					<view class="box d-jc-sb date-state">
						<text class="time">
							报名时间：{{item.createTime|dateFormatYearMine}}
						</text>
						<text>
							<text class="pass" v-if="item.status==0">
								已通过
							</text>
							<text class="check-ing" v-else-if="item.status==1">
								审核中
							</text>
							<text class="fail" v-else-if="item.status==2">
								已拒绝
							</text>
						</text>
					</view>
					<view class="line mb-3 mt-2">

					</view>
					<view class="record-info box">
						<view class="">
							<image :src="item.unityLogo" mode=""></image>
						</view>
						<view class="box-c ml-3">
							<view class="text-heide-2 title flex-1">
								{{item.unityName}}
							</view><view class=" item-name mt-3 flex-1 box d-ai-c d-jc-sb">
								<text>团长：{{item.nickName}}</text>
							</view>
							<view class=" item-name flex-1 box d-ai-c d-jc-sb">
								<text>电话：{{item.phone}}</text>
								<view class="" v-if="item.type===1">
									文艺团队
								</view>
								<view class="" v-if="item.type===2">
									志愿者小组
								</view>
							</view>
						</view>

					</view>
				</view>
			</view>
		

		</scroll-view>



	</view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				height: '500',
				refresherTriggered: false,
				_refresherTriggered: false,
				pageNum: 1,
				pageSize: 10,
				hasNextPage: true, //是否存在下一页
				applyRecordList: [],
				isShow:false


			};
		},
		onReady() {
			let that = this;
			uni.getSystemInfo({ //调用uni-app接口获取屏幕高度
				success(res) { //成功回调函数
					that.height = res.windowHeight //windoHeight为窗口高度，主要使用的是这个

				}
			})
		},
		onShow() {
			//清空数组和分页信息
			this.pageNum = 1
			this.applyRecordList = []
			this.getApplyRecord()
		},
		methods: {
			
			//下一页
			nextPage() {
				if (this.hasNextPage) {
					this.pageNum++
					this.getApplyRecord()
				}

			},
			getApplyRecord() {
				this.$api.getApplyRecord({}, this.pageNum, this.pageSize).then((res) => {
					this.applyRecordList = this.applyRecordList.concat(res.data.dataMap.list)
					if(this.applyRecordList.length<1){
						this.isShow=true
					}else{
						this.isShow=false
					}
				})
			},
			refresherrefresh() {
				console.log("自定义下拉刷新被触发");
				let _this = this;
				if (_this._refresherTriggered) {
					return;
				}
				_this._refresherTriggered = true;
				//界面下拉触发，triggered可能不是true，要设为true
				if (!_this.refresherTriggered) {
					_this.refresherTriggered = true;
				}
				this.loadStoreData();
			},
			refresherrestore() {
				console.log("自定义下拉刷新被复位");
				let _this = this;
				_this.refresherTriggered = false;
				_this._refresherTriggered = false;
			},
			refresherabort() {
				console.log("自定义下拉刷新被中止	");
				let _this = this;
				_this.refresherTriggered = false;
				_this._refresherTriggered = false;
			},
			loadStoreData() {
				let _this = this;
				this.listData();
				setTimeout(() => {
					_this.refresherTriggered = false; //触发onRestore，并关闭刷新图标
					_this._refresherTriggered = false;
				}, 1000)
			},
			listData() {
				let _this = this;
				//这里是调用后台接口的方法数据
			},

		}
	}
</script>

<style lang="less">
	.null {
		image {
			width: 340rpx;
			height: 340rpx;	
		}	
		text{
			color: #8b8b8b;
		}

	}

	.list-1 {
		.line {
			width: 100%;
			height: 2rpx;
			background-color: #EEEEEE;
		}

		.record {
			.date-state {

				.time {
					color: #333333;
				}

				.fail {
					color: #999999;
				}

				.pass {
					color: #FF5551;
				}

				.check-ing {
					color: #FF7E51;
				}

			}

			.record-info {
				.title {
					font-weight: bold;
					font-size: 32rpx;
					color: #666666;
					margin-top: -10rpx;
				}

				.item-name {
					width: 410rpx;
					color: #999999;
					font-size: 24rpx;
				}

				image {
					width: 250rpx;
					height: 164rpx;
					border-radius: 8rpx;
				}
			}

			width: 90%;
			background-color: #fff;
			border-radius: 16rpx;
			padding: 20rpx;

		}

	}

	.page {
		background-color: #F8F8F8;
		height: 100%;
	}
</style>

